import java.util.Scanner;

public class Main {

    //求和
    //给定 n 个整数，求他们两两相乘再相加的和

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] arr = new int[n + 1];
        long ans = 0;
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            arr[i] = scan.nextInt();
            ans += (long)arr[i] * sum;
            sum += arr[i];
        }
        System.out.println(ans);
    }


}
